//
//  RBMyGroupListCell.m
//  zhongzhenglu
//
//  Created by XL on 2022/8/12.
//

#import "RBMyGroupListCell.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import <Masonry.h>
#import "RBThemeConfig.h"
#import <UIColor+YYAdd.h>
#import <UIView+YYAdd.h>
#import "RBPager.h"
#import "RanTool.h"
#import <UIImage+YYAdd.h>
#import "UIImageView+RBAdd.h"

@interface RBMyGroupListCell()

@property(nonatomic, strong)IBOutlet UILabel *shopNameL;
@property(nonatomic, strong)IBOutlet UILabel *stateL;
@property(nonatomic, strong)IBOutlet UIImageView *goodsImgView;
@property(nonatomic, strong)IBOutlet UILabel *goodsNameL;
@property(nonatomic, strong)IBOutlet UILabel *groupNumL;
@property(nonatomic, strong)IBOutlet UILabel *priceL;

@end

@implementation RBMyGroupListCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self zoomSubViewsWithSelf];
}

- (void)setCellModel:(RBCellModel *)cellModel
{
    RBMyGroupModel *model = cellModel.cellData;
    self.shopNameL.text = model.store_name;
    self.stateL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(14)] color:[UIColor colorWithHexString:({
            NSString *color = @"";
            if(model.status == 1)
            {
                color = @"#F04D27";
            }
            else if(model.status == 2)
            {
                color = @"2478E1";
            }
            else
            {
                color = @"9C9C9C";
            }
            color;
        })] string:model.status_zh];
        //            [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(14)] color:[UIColor colorWithHexString:@"#9C9C9C"] string:@"已失效 "];
        //            [maker addAttributeStringWithImage:[UIImage imageWithColor:UIColor.redColor] imageSize:CGSizeMake(Zoom(12), Zoom(14)) maxFont:[UIFont systemFontOfSize:Zoom(14)]];

    }];
    [self.goodsImgView setImageWithUrl:model.goods_picurl placeHolder:nil];
    self.goodsNameL.text = model.goods_title;
    self.groupNumL.text = [NSString stringWithFormat:@" %@人团 ", model.group_people_max];
    self.priceL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(11)] color:[RBThemeConfig priceRedColor] string:@"¥"];
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(15)] color:[RBThemeConfig priceRedColor] string:model.group_price];
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(12)] color:[RBThemeConfig textGrayColor] string:@"　" lineSpacing:0];
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(12)] color:[RBThemeConfig textGrayColor] string:[NSString stringWithFormat:@"¥%@", model.goods_price] lineSpacing:0 througnLineHeight:1 throughLineColor:[RBThemeConfig textGrayColor]];
    }];
}

@end
